# coding=utf-8
# __author:wanghao

from case.base import loader
from case.base.basecase import BaseCase
from unittest import skip
from case.base import route
from case.pages.storepage import StorePage

"""
小程序小店页面测试
"""


class StorePageTest(BaseCase):
    def __init__(self, methodName='runTest'):
        super(StorePageTest, self).__init__(methodName)
        self.storePage = StorePage(self)

    """
    case1:首页的"小店"模块存在
    """

    def test_01_store_module(self):
        self.logger.info("case1:首页的'小店'模块存在")
        self.storePage.check_homepage_store_element()

    """
     case2:进入小店页面
    """

    def test_02_into_store_page(self):
        self.logger.info("case2:进入小店页面")
        self.storePage.check_into_store_page()

    """
    case3:进入小店商品商详页to_store_good_share_page
    """

    def test_03_into_goods_detail(self):
        self.logger.info("case3:进入小店商品商详页to_store_good_share_page")
        self.storePage.to_store_good_detail_page()

    """
    case4:小店"客服"模块存在
    """

    def test_04_chat_contact_module(self):
        self.logger.info("")
        self.storePage.check_store_chat_contact_btn()

    """
    case5:小店的"分享"模块存在
    """

    def test_05_store_module(self):
        self.logger.info("case5:小店的'分享'模块存在")
        self.storePage.check_store_share_btn()

    """
    case6:去小店购买商品
    """

    def test_06_buy_flow(self):
        self.logger.info("case6:去小店购买商品")
        # 跳转到搜索页面
        self.storePage.to_store_good_detail_page()
        self.storePage.check_shopping_flow()

    """
    case7:进入小店分享页
    """

    def test_07_into_goods_share_page(self):
        self.logger.info("case7:进入小店分享页")
        self.storePage.to_store_good_share_page()


if __name__ == "__main__":
    # import unittest
    # loaded_suite = unittest.TestLoader().loadTestsFromTestCase(HomePageTest)
    # result = unittest.TextTestRunner().run(loaded_suite)
    # print(result)

    loader.run(module="case.storepage_test", config="../config.json", generate_report=True)
